package cn.com.khproc;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;
import java.util.List;
import java.util.Map;

public class GetParameter {
	private static final Log log = LogFactory.getLog(GetParameter.class);

	public static List<Map<String, Object>> doService(DataSource dataSource, String Object_Id) {
		List<Map<String, Object>> reList = null;
		try {
			JdbcTemplate jt = new JdbcTemplate(dataSource);

			String sql = "Select R1.Sync_Object, R2.Param_Name, R2.Param_Rank, R2.Param_Type, R2.Param_Mode From KH_Outinterface_Main R1 Left Join KH_Outinterface_Config R2 On Upper(R1.Sync_Object) = Upper(R2.Sync_Object) Where Upper(R1.Sync_Type) = Upper('" + Object_Id + "') Order By R2.Param_Rank";
			log.debug("GetParameterQuerySQL:" + sql);

			reList = jt.queryForList(sql);
			log.debug("List documentList:" + Integer.valueOf(reList.size()));

		} catch (Exception e) {
			log.error("GetParameter Exception:", e);
		}

		return reList;
	}
}